implement templating behavior
Reported by Philipp Pirozhkov | November 28th, 2008 @ 10:48 AM | in basic templating
There are a lot of templating examples in README file, they should be moved to specs directory, with the following syntax: /behave/retem.re:
context('flow control') do
context('if statement') do
template = renderer.parse('{if a}yes{end}')
should('be resolved') do
assert(template.render({~a: true}), 'yes')
assert(template.render({~a: false}), '')
Comments and changes to this ticket
-

Philipp Pirozhkov November 28th, 2008 @ 10:48 AM
- Tag set to behave
Variable substitution and if/unless flow control behavior almost done
-

Philipp Pirozhkov December 15th, 2008 @ 02:04 AM
almost finished
i18n, preprocessing, extending with code to go
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Templating engine for Ryan/Reia
Retem provides a convenient syntax and a lot of features available out of the box:
* variables
* flow control
* filters
* i18n
* template nesting
== Usage
renderer = Retem.new()
template = renderer.parse("""Total {apples|count:~apples}
{for apple in apples} {apple.color apple.weight|kg} {end}""")
apples = [{~color: 'red', ~weight: 0.2}, {~color: 'yellow', ~weight: 0.15}]
renderer.render({~apples: apples})
=> Total 2 apples
.. red 0.2kg
.. yellow 0.15kg
There are a lot of templating examples in README on http://github.com/pirj/ryan/tree/master/src/retem